

function setGoodsAttr(goods_id)
{
  //------  goods attr validate
	var attrSize = jQuery('#attrsize').val();
	var attr_value='';
	for( var j = 0; j < attrSize; j++ )
	{ 
		var item;
		var attrStr ='';
		var attrId = jQuery('#attr_id'+j).val();
		var attrName = jQuery('#attr_name'+j).val();
		var conType = jQuery('#con_type' + j).val();
		var defaultTag = jQuery('#default_tag' + j).val();
		
		// select
		if(conType == '0')
		{ 
		  attrStr= jQuery('#attr_value'+j).val();
			if( attrStr == '' && defaultTag=='0')
			{
				alert('请选择' + attrName+'！'  );
 
				return;
			}  
		}
	 
	  // input
		if(conType == '1')
		{
				attrStr = jQuery('#attr_value'+j).val(); 
				if( attrStr == '' && defaultTag=='0')
				{
					alert('请输入' + attrName+'！');
 
					//document.getElementById('attr_id'+j).focus();
					return;
				}  
		}
		
		//chechbox
		if( conType == '2')
		{
			var valueSize = jQuery('#valuesize'+j).val();
			for( var r = 0; r < valueSize; r++ ){
				 if( jQuery('#attr_value'+j+'_'+r).is(':checked')){
					attrStr +=  jQuery('#attr_value'+j+'_'+r).val() + '|'; 
				 } 
			}  
			if( attrStr == '' && defaultTag=='0')
			{
				alert('请选择' + attrName+'！' );
				return;
			}  
		}
		if(attrStr != ''){
			item = attrId+"|"+attrStr;
			attr_value += item +',';
		}
	}
  var rdata = Math.round(Math.random()* 10000);
  var udata ='attr_value='+attr_value+'&rdata='+rdata; 
  jQuery.ajax({
		   type: 'POST',
		   url: '/templets/html/8diansc/jsp/ajaxCatAttr.jsp',
		   data: udata,
			async:false,									   
		   success: function(response){
		   jQuery('#hiddenAttrData',window.parent.document).html(response);
			jQuery('#goods_attr_id_' + goods_id,window.parent.document).html(jQuery('#hiddenAttrData',window.parent.document).html());
			//window.parent.document.getElementById('goods_attr_id_'+goods_id).innerHTML = response ;
		   }
   }); 
		jQuery('#goods_attr' + goods_id,window.parent.document).val(attr_value);
   
	self.parent.tb_remove();
           
}

function submitOrderForm(valz){
		var smObj = document.getElementsByName('paycheck');
		var paytype="alipay";
		for (var i = 0; i < smObj.length; i++)
		{
			if(smObj[i].checked) {
			 paytype = smObj[i].value;
			}
		}

	
		if(jQuery('#user_id').val() != ""){		
		if (paytype == 'alipay')
		{
			document.paysubmit.action="/program/jsalipay/index.jsp";
		}
		else if (paytype == '99bill')
		{
			document.paysubmit.action="/program/99bill/send.jsp";
		}
		else if (paytype == 'chinabank')
		{
			document.paysubmit.action="/program/chinabank/Send.jsp";
		}
 			
		document.paysubmit.submit();
		}
		else
		{
			alert("请登录后继续操作!");
		}
}

function submitdbOrderForm(valz){
	if(jQuery('#user_id').val() != ""){
		 
		document.dbpaysubmit.action="/program/jsalipay/dbpay.jsp";
		document.dbpaysubmit.submit();
		}else{
			alert("请登录后继续操作!");
		}
}




